﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

/// <summary>
/// Summary description for RandomString
/// </summary>
public class RandomString
{

	public RandomString()
	{
		//
		// TODO: Add constructor logic here
		//
	}
    public static string GenerateRandomCode()
    {
        // For generating random numbers.
         Random random = new Random();
        string s = "";
        for (int i = 0; i < 6; i++)
        {
            int j = random.Next(1, 4);
            if (j % 3 == 0)
                s = String.Concat(s, char.ConvertFromUtf32(random.Next(48, 57)).ToString());
            else if (j % 3 == 1)
                s = String.Concat(s, char.ConvertFromUtf32(random.Next(65, 90)).ToString());
            else
                s = String.Concat(s, char.ConvertFromUtf32(random.Next(97, 122)).ToString());
        }
            
        return s;
        
    }
}
